package com.yxhl.zoume.domain.interactor.busticket;

import com.google.protobuf.GeneratedMessageV3;
import com.yxhl.protobuf.OneYxBusInfoRequest;
import com.yxhl.protobuf.OneYxBusInfoResponse;
import com.yxhl.zoume.data.http.repository.busticket.BusTicketRepository;
import com.yxhl.zoume.domain.DomainConstants;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by Xboy on 16/6/2.
 */

public class GetZouMeBusDetailUseCase extends com.yxhl.zoume.domain.interactor.base.ProtoUseCase<OneYxBusInfoResponse> {
    private final BusTicketRepository repository;

    @Inject
    public GetZouMeBusDetailUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                                    @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                                    BusTicketRepository repository) {
        super(uiThread, executorThread);
        this.repository = repository;
    }

    @Override
    protected Observable<OneYxBusInfoResponse> buildObservable(GeneratedMessageV3 param) {
        return repository.getZouMeBusDetail((OneYxBusInfoRequest) param)
                .observeOn(uiThread)
                .subscribeOn(executorThread);
    }
}
